mob/proc
	checkbanned()
		if(src.key in flist("bans/ipban/"))
			usr << "You are banned!"
			del(usr)
		if(src.key in flist("bans/keyban/"))
			usr << "You are banned!"
			del(usr)
		if(src.key in flist("bans/***IP***"))
			usr << "You are banned!"
			del(usr)
		else
			..()


/* This library will explain how to ban people using files and directorys
/  GIVE CREDITS TO KILLER22 FOR USE, PLEASE. */
mob
	var
		ip
	GM
		verb
			UnBan()
				set category="Admin"
				switch(alert("What kind of ban would you like to remove?","Unban","IP","Key","Both"))
				//^Prompt for type of ban to remove

					if("IP")
						//^If "IP" is chosen

						var/M=input("What IP would you like to remove?")in flist("bans/ipban/") + list(" ","Cancel")
						//^Prompt for an IP in flist("ipban/")

						if(M=="Cancel"||M==" ")//< if src chose "Cancel" or " "...
							return //< return

						else
							//^ if M isn't Cancel

							world<<"[M] has been unbanned" //<tell the world whats up
							fdel("bans/ipban/[M]") //< remove M from ipban folder

					if("Key")
						//^If "Key" is chosen

						var/M=input("What Key would you like to remove?")in flist("bans/keyban/") + list(" ","Cancel")
						//^Prompt for a Key in flist("keyban/")

						if(M=="Cancel"||M==" ")//< if src chose "Cancel" or " "...
							return //< return

						else
							//^ if M isn't Cancel

							world<<"[M] has been unbanned" //<tell the world whats up
							fdel("bans/keyban/[M]") //< remove M from ipban folder

					if("Both")
						//^If "Both" is chosen

						var/M=input("What IP, or Key would you like to remove?")in list("bans/***IP***")/*Get creative*/ + flist("bans/ipban/") + list("bans/***Key***")/*Get creative*/ + flist("bans/keyban/") + list(" ","Cancel")
						//^Prompt for an IP, or Key in flist

						if(M=="Cancel"||M=="***IP***"||M=="***Key***"||M==" ")
							//^ if src chose "Cancel" or " " or "***IP***" or "***Key***"...

							return //< return

						else
							//^ if M isn't Cancel

							world<<"[M] has been unbanned" //<tell the world whats up
							fdel("bans/ipban/[M]") //< remove M from ipban folder
							fdel("bans/keyban/[M]") //< remove M from keyban folder
			IPBan(mob/M)
				set category="Admin"
				switch(alert("Are you sure you want to IP ban [M].","IP Ban","Ban","Nevermind"))
				//Prompt for ban ^

					if("Ban")
						//^ if "Ban" is chosen...

						world<<"[usr] has banned [M]." //< tell the people whats going on
						fcopy("[src]","bans/ipban/[src.ip]") //< add src to the ipban folder
						del(src) //< Get rid of src

					else
						//^ if "Ban" isn't chosen...

						return

			KeyBan(mob/M)
				set category="Admin"
				switch(alert("Are you sure you want to key ban [M].","IP Ban","Ban","Nevermind"))
				//Prompt for ban ^

					if("Ban")
						//^ if "Ban" is chosen...

						world<<"[usr] has banned [M]." //< tell the people whats going on
						fcopy("[src]","bans/keyban/[src.key]") //< add src to the keyban folder
						del(src) //< Get rid of src

					else
						//^ if "Ban" isn't chosen...

						return

			KeyAndIPBan(mob/M)
				set category="Admin"
				switch(alert("Are you sure you want to IP ban and Key ban [M].","IP Ban","Ban","Nevermind"))
				//Prompt for ban ^

					if("Ban")
						//^ if "Ban" is chosen...

						world<<"[usr] has banned [M]." //< tell the people whats going on
						fcopy("[src]","bans/ipban/[src.ip]") //< add src to the ipban folder
						fcopy("[src]","bans/keyban/[src.key]") //< add src to the keyban folder
						del(src) //< Get rid of src

					else
						//^ if "Ban" isn't chosen...

						return

			ManualBan()
				set category="Admin"
				var/M=input("Who do you want to ban? (IP \[ex. 235.123.18.2 or Key \[ex. Bob The Crapper])")
				//^ prompt for a key or ip

				if(findtext(M,"."))
					//^ if there is a dot in M, its probaly an IP

					fcopy("[M]","bans/ipban/[M]") //< add M to the ipban folder

				else
					//^ if a dot is not found in M, its going to be a key

					fcopy("[M]","bans/keyban/[M]") //< add M to the keyban folder

				for(var/mob/m in world)
					//^ scan the world for a mob

					if(m.key == M || m.ip == M)
						//^ if m's key or ip = M...

						del(m) //< get rid of him
						return //< end the for() proc

					else
						//^ if m.key does not = M or m.ip does not = M

						continue //< continue until you have scanned all m's or found the right m

				world<<"[M] has been banned." //< tell the world what happened


	Login() //< login proc

		if(fexists("bans/ipban/[usr.ip]")&&usr.ip!=null||fexists("bans/keyban/[usr.ckey]")||fexists("bans/keyban/[usr.key]"))
			//^ check to see if usr is banned

			src<<"You have been banned." //< tell src that he/she is banned
			sleep(1) //< 0.01 second sleep to make sure src got the message
			del(src) //< no get rid of src
			return



		..() //< continue with other logins